﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WFCSharp_I
{
    public partial class Signup : Form
    {
        public Signup()
        {
            InitializeComponent();
        }

        private void submit_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Username : " + userNameText.Text +
                " - Password : " + passwordText.Text
                + " - Birthday : " + birthdayMasked.MaskCompleted + ","
                + birthdayMasked.MaskFull, "My Sign Up");
            // accp1110b@gmail.com, cnc123456
            messageText.Text = "User name : " + userNameText.Text + "\r\n";
            messageText.Text += "Password : " + passwordText.Text + Environment.NewLine;
            messageText.Text += "Birthday : " + birthdayMasked.Text + "\r\n";

            messageText.Text += "Job : " + jobCombo.SelectedItem + "\r\n";
            messageText.Text += "Location : " + countryCombo.SelectedItem
                + ", " + cityCombo.SelectedItem + "\r\n";

            string gender = "";

            if (maleRadio.Checked)
                gender = maleRadio.Text;
            else if (femaleRadio.Checked)
                gender = femaleRadio.Text;

            messageText.Text += "Gender : " + gender + "\r\n";

            string status = "";
            if (singleRadio.Checked)
                status += singleRadio.Text;
            else if (doubleRadio.Checked)
                status = doubleRadio.Text;

            messageText.Text += "Status : " + status + "\r\n";

            string children = "";
            if (oneCheck.Checked)
                children += oneCheck.Text + ", ";

            if (twoCheck.Checked)
                children += twoCheck.Text + ", ";

            if (threeCheck.Checked)
                children += threeCheck.Text + ", ";

            if (fourCheck.Checked)
                children = fourCheck.Text + ", ";

            messageText.Text += "Childrent : " + children + "\r\n";

            string priority = "";
            for (int i = 0; i < checkedList.CheckedItems.Count; i++)
                priority += checkedList.CheckedItems[i].ToString() + ",";

            messageText.Text += "Priority : " + priority;
        }

        private void closeButton_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void resetButton_Click(object sender, EventArgs e)
        {
            userNameText.Text = passwordText.Text = "";
        }

        private void Signup_Load(object sender, EventArgs e)
        {
            userNameText.Text = "Enter user name here!";
            jobCombo.SelectedIndex = 0;
            countryCombo.SelectedIndex = 0;
            maleRadio.Checked = true;
        }

        private void Signup_Shown(object sender, EventArgs e)
        {
            userNameText.Focus();
        }

        private void countryCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            cityCombo.Items.Clear();

            if (countryCombo.SelectedIndex == 0)
            {
                cityCombo.Items.Add("Viet nam 1");
                cityCombo.Items.Add("Viet nam 2");
                cityCombo.Items.Add("Viet nam 3");
            }
            else
            {
                cityCombo.Items.Add("Combodia 1");
                cityCombo.Items.Add("Combodia 2");
                cityCombo.Items.Add("Combodia 3");
            }

            cityCombo.SelectedIndex = 0;
        }
    }
}
